@import 'npm-scss-util/src/npm-scss-util.scss';

$--color-white: #fff !default;
$--color-info: #909399 !default;
$--color-primary: #4F65FE !default;
$--color-text-primary: #303133 !default;
$--color-text-regular: #606266 !default;

@mixin when($state-prefix, $state) {
  @at-root {
    &.#{$state-prefix + $state} {
      @content;
    }
  }
}

.npm-com-bg-dialog {
  position: relative;
  margin: 0 auto r(50);
  background: $--color-white;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  width: 50%;

  @include when(is-, fullscreen) {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    height: 100%;
    overflow: auto;
  }

  @at-root &__wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    overflow: auto;
    margin: 0;
    background: rgba(0, 0, 0, 0.5);
  }

  &__header {
    padding: r(20);
    padding-bottom: r(10);
    text-align: center;
    border: r(1) solid #eeeeee;
  }

  &__headerbtn {
    position: absolute;
    top: r(20);
    right: r(20);
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: r(16);

    .npm-com-bg-dialog__close {
      color: $--color-info;
    }

    .close-icon {
      display: inline-block;
      background: url('./icon/close_icon.png') no-repeat center;
      background-size: 100%;
      width: r(20);
      height: r(20);
    }

    &:focus,
    &:hover {
      .npm-com-bg-dialog__close {
        color: $--color-primary;
      }
    }
  }

  &__title {
    line-height: r(24);
    font-size: r(18);
    color: $--color-primary;
  }

  &__body {
    padding: r(15) r(20);
    color: $--color-text-regular;
    font-size: r(14);
    word-break: break-all;
  }

  &__footer {
    padding: r(20);
    padding-top: r(10);
    text-align: right;
    box-sizing: border-box;
  }

  &--center {
    text-align: center;

    .npm-com-bg-dialog__body {
      text-align: initial;
      padding: r(25) r(25) r(30);
    }

    .npm-com-bg-dialog__footer {
      text-align: inherit;
    }
  }
}

.dialog-fade-enter-active {
  animation: dialog-fade-in 0.3s;
}

.dialog-fade-leave-active {
  animation: dialog-fade-out 0.3s;
}

@keyframes dialog-fade-in {
  0% {
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }

  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes dialog-fade-out {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }

  100% {
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }
}
